/*
 * Group 3, User Interface Programming II (vt11)
 * Pooya | Flora | Monica | Can
 */
package vical.view.tutorial;

import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;

/**
 * The tutorial of how to navigate between views
 * 
 * @author Can
 */
public class TutorialNavigation extends GlassTutorial {
    
    private TutorialContainer container;

    public TutorialNavigation(TutorialContainer container) {
        super(container.getNavigationBar(), container.getJMenuBar(), container.getContentPane());
        
        this.container = container;

        this.tutorialTitle = "How to navigate? (1 / 3)";

        this.instructions = ""
                + "1. To navigate among different views:\n"
                + "    By clicking 'Month' / 'Week' / 'Day' / 'List' buttons, you \n"
                + "    can navigate to different views.\n"
                + "\n"
                + "(Click this panel to see next instruction)";
    }

    @Override
    protected void mouseEventOnLiveComponent(Point mousePoint, Component component, MouseEvent e) {
        super.mouseEventOnLiveComponent(mousePoint, component, e);
        if (e.getClickCount() >= 1) {
            this.setVisible(false);
        }
    }

    @Override
    protected Rectangle getInstructionPlace() {
        Rectangle rect = super.getInstructionPlace();
        Point location = getPoint(liveComponent.getParent(), liveComponent.getLocation());
        location.translate(liveComponent.getWidth() / 2, liveComponent.getHeight() + 10);
        rect.setLocation(location);
        rect.width = liveComponent.getWidth() / 2 - 4;
        rect.height = 200;
        return rect;
    }

    @Override
    protected void instructionPanelClicked() {
        container.setGlassTutorial(new TutorialNavigation2(container));
    }
}
